import 'package:flutter/material.dart';
import 'package:wis_flutter/bottomBar.dart';     // 底部导航条
import 'package:wis_flutter/index.dart';        // wis flutter 组件 



// 消息提示
class TooltipPage extends StatefulWidget {

  TooltipPage({Key key}) : super(key: key);

  @override
  _TooltipPageState createState() => _TooltipPageState();
}

class _TooltipPageState extends State<TooltipPage> {




    @override
    Widget build(BuildContext context) {
      return Scaffold(
          appBar: AppBar( title: const Text('消息提示') ),  // 头部导航条
          bottomNavigationBar: BottomBarWidget(),       // 底部导航条
          backgroundColor: Colors.blue[10],
          body: Builder(builder: (BuildContext context) {
            return Wrap(
              children: <Widget>[

                Container(
                  child: Text(
                    "注意： body 多了一层【 body: Builder(builder: (BuildContext context) {}) 】",
                    style: TextStyle(
                        color: Colors.red,
                        fontWeight: FontWeight.w700,
                    )
                  ),
                ),

                FlatButton(
                  onPressed: (){

                    Scaffold.of(context).showSnackBar(WisMessage.succeed(
                      text:"操作成功",    // 提示文字  默认操作成功
                      icon: Icons.check,  // 提示文字  默认 Icons.check
                      duration: 700,      // 延时  毫秒  默认 700
                      floating: false    // 悬浮  默认 false
                    ));
                  },
                  child: Text("底栏提示-固定底栏"),
                  color: const Color.fromRGBO(25,190,107,1),
                  textColor: Colors.white,
                  shape: RoundedRectangleBorder(
                    side: BorderSide(
                      color: Colors.white,
                      width: 1,
                    ),
                    borderRadius: BorderRadius.circular(4)
                  ),
                ),


                FlatButton(
                  onPressed: (){
                    Scaffold.of(context).showSnackBar(WisMessage.succeed(
                      text:"底栏提示-悬浮底栏",    // 提示文字  默认操作成功
                      icon: Icons.access_time,  // 提示文字  默认 Icons.check
                      duration: 1000,      // 延时  毫秒  默认 700
                      floating: true    // 悬浮  默认 false
                    ));
                  },
                  child: Text("底栏提示-悬浮底栏"),
                  color: Colors.blue,
                  textColor: Colors.white,
                  shape: RoundedRectangleBorder(
                    side: BorderSide(
                      color: Colors.white,
                      width: 1,
                    ),
                    borderRadius: BorderRadius.circular(4)
                  ),
                ),


                FlatButton(
                  onPressed: (){

                    Scaffold.of(context).showSnackBar(WisMessage.warning(
                      text: "警告"
                    ));

                  },
                  child: Text("警告"),
                  color: const Color.fromRGBO(255,153,0,1),
                  textColor: Colors.white,
                  shape: RoundedRectangleBorder(
                    side: BorderSide(
                      color: Colors.white,
                      width: 1,
                    ),
                    borderRadius: BorderRadius.circular(4)
                  ),
                ),

                FlatButton(
                  onPressed: (){

                    Scaffold.of(context).showSnackBar(WisMessage.error(
                      text: "错误"
                    ));
                    
                  },
                  child: Text("错误"),
                  color: const Color.fromRGBO(237,64,20,1),
                  textColor: Colors.white,
                  shape: RoundedRectangleBorder(
                    side: BorderSide(
                      color: Colors.white,
                      width: 1,
                    ),
                    borderRadius: BorderRadius.circular(4)
                  ),
                ),

              ]
            );
          })
      ); 
    }
}




